Use YAML counter_defs.yaml as single source of truth for all GFX metrics#79
Open
mehdi-saeedi wants to merge 2 commits intomainfrom
Open
Use YAML counter_defs.yaml as single source of truth for all GFX metrics#79mehdi-saeedi wants to merge 2 commits intomainfrom
mehdi-saeedi wants to merge 2 commits intomainfrom
Conversation
Move all metric definitions from Python @Metric decorators in gfx942.py and gfx90a.py into counter_defs.yaml. This unifies the approach already used by RDNA (gfx1201/gfx1151) to cover CDNA (gfx942/gfx90a) as well. Changes: - base.py: extend YAML expression namespace with device spec variables (BASE_CLOCK_MHZ, HBM_BANDWIDTH_GBS, DURATION_US, etc.) and support unsupported_reason field in YAML definitions - counter_defs.yaml: add 18 CDNA metrics with architecture-specific expressions; rename RDNA metrics to dotted convention (GPU_UTILIZATION -> compute.gpu_utilization, L2_HIT_RATE merged into memory.l2_hit_rate) - gfx942.py/gfx90a.py: remove all @Metric methods (~1100 lines), keep only infrastructure (device specs, counter groups, rocprof invocation) - Update tests to use YAML metric computation path Made-with: Cursor
93f5eda to
9b09864
Compare
…tion Remove redundant method overrides (get_metric_counters, get_required_counters, compute_metric_stats) that duplicated base class logic. Both RDNA4 backends now follow the same pattern as gfx942/gfx90a. Made-with: Cursor
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
@metricdecorators ingfx942.pyandgfx90a.pyintocounter_defs.yaml, unifying the approach already used by RDNA (gfx1201/gfx1151) to cover CDNA (gfx942/gfx90a). Remove ~1,200 lines of decorator-based metric code.DeviceSpecswith runtime queries (rocminfofor CU count, wavefront size, L2 cache, clocks;rocm-smifor memory clock). Fixes 5 incorrect MI210 values that were using MI250X numbers (HBM bandwidth, L2 size, FLOPS)._BUILTIN_EXPRESSION_VARSis now derived fromDeviceSpecsfields viadataclasses.fields()instead of a manually maintained static set. YAML expression namespace injection is also dynamic.Changes
counter_defs.yamldevice_info.pybase.pyDeviceSpecsfields (l2_bandwidth_gbs,fp32_tflops,fp64_tflops,int8_tops)gfx942.py/gfx90a.py@metricmethods, now usequery_device_specs()test_backend_metrics.pytest_error_handling.pyBugs fixed
hbm_bandwidth_gbsl2_size_mbfp32_tflopsfp64_tflopsint8_topsTest plan